<?php

namespace Cache;

class Cache {
	private $rootDir, $downloadDir;
	private $logger;
	
	public function __construct ($g) {
		$pathReference = $g->getPathReference();

		$this->rootDir = $pathReference->getCache();
		$this->downloadDir = $pathReference->getDownload();

		$this->logger = $g->getLoggerFactory()->newDefault(__CLASS__);
	}

	public function exists ($file) {
		$found = file_exists($this->downloadDir.'/'.$file);
		$this->logger->fine('checking whether '.$file.' is cached... '.($found? 'true' : 'false'));
		return $found;
	}
}
